<h1>Editing project</h1>

<% form_for(@project) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :project_reference %><br />
    <%= f.text_field :project_reference %>
  </p>
  <p>
    <%= f.label :project_number %><br />
    <%= f.text_field :project_number %>
  </p>
   <p>
    <%= f.label :state %><br />
    	<%= f.radio_button :state, 1 %>Preview
    	<%= f.radio_button :state, 2 %>Started
    	<%= f.radio_button :state, 3 %>Finished
 </p>
  <p>
    <%= f.label :budget %><br />
    <%= f.text_field :budget %>
  </p>
  <p>
    <%= f.label :real_costs %><br />
    <%= f.text_field :real_costs %>
  </p>
 <p>
    <%= f.label :final_client_id %><br />
    <select name="project[final_client_id]">
	<% @customers.each do |customer| %>
		<%if customer.id==@project.final_client_id %>
      <option selected value="<%= customer.id %>">
			<%= customer.name %>
	   </option>
	 <%
    else
	%>
       <option value="<%= customer.id %>">
			<%= customer.name %>
	   </option>
    <% end %>
	<% end %>
	</select>
  </p>
  <p>
    <%= f.label :client_id %><br />
    <select name="project[client_id]">
	<% @customers.each do |customer| %>
	<%if customer.id==@project.client_id %>
      <option selected value="<%= customer.id %>">
			<%= customer.name %>
	   </option>
	 <%
    else
	%>
       <option value="<%= customer.id %>">
			<%= customer.name %>
	   </option>
    <% end %>
	<% end %>
	</select>
  </p>
  <p>
    <%= f.label :responsible_id %><br />
    <select name="project[responsible_id]">
	<% @employees.each do |employee| %>
	<%if employee.id==@project.responsible_id %>
      <option selected value="<%= employee.id %>">
			<%= employee.name %>
	   </option>
	 <%
    else
	%>
       <option value="<%= employee.id %>">
			<%= employee.name %>
	   </option>
    <% end %>
	<% end %>
	</select>
  </p>
  <p>
    <%= f.submit 'Update' %>
  </p>
<% end %>

<%= link_to 'Show', @project %> |
<%= link_to 'Back', projects_path %>